﻿@model Guline.Web.CentralModels.Object.Message
@{
    ViewBag.Title = @Guline.Web.CentralLanguages.Main.lblCreateSMS;
    Layout = "~/Views/Shared/_GLSettingLayout.cshtml";
}
<span class="s_title_body_right">@ViewBag.Title</span>
<div class="s_content_body_right" style="text-align:center">
    @using (Html.BeginForm())
    {
        @Html.ValidationMessage("NotDevice")
        <table border="0" style="display:inline-block">
            <col style="width:25%">
            <col style="width:75%">
            <tr class="div_filed">
                <td class="td_right">@Guline.Web.CentralLanguages.Main.lblContact</td>
                <td class="td_left">
                    @Html.DropDownList("ContactID", "--- Select Contact ---")
                    <span class="msg">@Html.ValidationMessageFor(m => m.ContactID)</span>
                </td>
            </tr>
            <tr class="div_filed">
                <td class="td_right">@Guline.Web.CentralLanguages.Main.lblToNumber</td>
                <td class="td_left">
                    @Html.TextBoxFor(m => m.ToPhoneNumber, new { @readonly=true})
                    @*<span style="font-weight:bold" id="ToPhoneNum">Select Contact</span>*@
                    <span class="msg">@Html.ValidationMessageFor(m => m.ContactID)</span>
                </td>
            </tr>
            <tr class="div_filed">
                <td class="td_right">@Guline.Web.CentralLanguages.Main.lblContent</td>
                <td class="td_left">
                    @Html.TextAreaFor(m => m.Content,new { @class = "contentSMS"})
                    <span class="msg">@Html.ValidationMessageFor(m => m.Content)</span>
                </td>
            </tr>
            <tr class="div_filed">
                <td class="td_right">@Guline.Web.CentralLanguages.Main.lblNote</td>
                <td class="td_left">
                    @Html.TextAreaFor(m => m.Notes, new { @class = "noteSMS" })
                    <span class="msg">@Html.ValidationMessageFor(m => m.Notes)</span>
                </td>
            </tr>
        </table>
        <div class="submit">
            <input type="submit" value="@Guline.Web.CentralLanguages.Main.lblCreate" class="btn_submit center" />
            <a href="@Url.Action("Index")" class="center s_cancel">@Guline.Web.CentralLanguages.Main.lblCancel</a>
        </div>
    }
</div>

<script type="text/javascript">
    function GetPhoneNum() {
        var ContactID = $("#ContactID").val()
        if (ContactID == "")
        {
            $('#ToPhoneNumber').empty();
            $('#ToPhoneNumber').val("Select Contact");
        }
        else {
            $.ajax({
                type: "POST",
                data: {
                    ID: ContactID,
                },
                url: "@Url.Action("GetPhoneNumber", "Message")",
                datatype: "json",
            success: function (data) {
            
                $('#ToPhoneNumber').val(data);
            }
        });
        }
    };
</script>

<script>
    $(document).ready(function () {
        $("#ContactID").click(function () {
            GetPhoneNum();
        })
    });
</script>



